<?php if($user['avatar']) : ?>
    <img src="/images/uploads/userAvatars/<?php echo $user['avatar']; ?>" style="width:45px"/>
<?php else : ?>
    <img src="/images/prettyImg/default-avatarl.jpg" width="45px"/>
<?php endif; ?>
    <span style="color: #942a25; font-size: 45px;"><?php echo $user['displayName']; ?></span>
    <div style="color: gray"><?php echo Yii::app()->dateFormatter->format("dd MMMM yyyy года в HH:mm", $user['logDate']); ?></div>
<br/><br/>
<?php $this->renderPartial('//partials/userMenu', array('userName'=>$user['login'], 'countNewComments'=>$this->countNewComments['count'], 'countNewMessages'=>$this->countNewMessages['count'])); ?>
<br/><br/>

<h3 style="color: violet">Свежие коментарии</h3>
<?php if(!empty($comments)) : ?>
    <?php for($i=0, $j=0; $i<count($comments); $i++, $j++) : ?>
        <?php
        foreach($reviews as $r) {
            if($r['revId'] == $comments[$i]['revId']) {
                $targetRev = $r; break;
            }
        }?>

        <?php $paramsArr = array('url'=>$targetRev['url'], 'partnerUrl'=>$targetRev['partnerUrl'], 'catId'=>$targetRev['catId']) ; ?>

        <?php echo $targetRev['catName'].' | '.$targetRev['name']; ?>
        
        <?php if(!empty($comments[$i]['subCats'])) : ?>
            <?php for($l=0; $l<count($comments[$i]['subCats']); $l++) : ?>
                <span style="background-color:<?php echo Yii::app()->params['colors'][$l%10]; ?>">
                    <a href="<?php echo Yii::app()->createUrl('partner/default/cat', array('catId'=>$comments[$i]['subCats'][$l]['catId'], 'parentId'=>$comments[$i]['subCats'][$l]['parentId'])); ?>"> <?php echo $comments[$i]['subCats'][$l]['name']; ?> </a>
                </span>&nbsp;
            <?php endfor; ?>
        <?php endif; ?> 

        <div style="background-color:<?php echo $comments[$i]['isNew'] ? Yii::app()->params['colors'][$i%10]  : 'white';?>">
            <?php echo Yii::app()->dateFormatter->format("dd MMMM yyyy года в HH:mm", $comments[$i]['date']); ?><br/>
            <?php if(!empty($targetRev['title'])) : ?>
                <a href="<?php echo Yii::app()->createUrl('partner/profile/review', $paramsArr);?>"><?php echo mb_strlen($targetRev['title']) > 30 ? mb_substr($targetRev['title'], 0, 30, 'utf-8').'...' : $targetRev['title'] ; ?></a>
            <?php else : ?>
                <a href="<?php echo Yii::app()->createUrl('partner/profile/review', $paramsArr);?>">...</a>
            <?php endif; ?>

            <?php echo mb_strlen($comments[$i]['text'], 'utf-8') > 200 ? mb_substr($comments[$i]['text'], 0, 200, 'utf-8').'...' : $comments[$i]['text']; ?><br/>
            <a href="<?php echo Yii::app()->createUrl('partner/profile/review', $paramsArr);?>">Читать дальше</a>&nbsp;
        </div>
        <hr/><br/>
    <?php endfor; ?>
<?php else : ?>
    Пользователь пока не оставил ни одного комментария
<?php endif; ?>

<div class="pages">
    <?php $this->widget('CLinkPager', array('pages' => $pagination)); ?> 
</div>      